<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        #box {
            position: relative;
            width: 180px;
            height: 160px;
            margin: 100px auto;
        }
        #code {
            position: absolute;
            right: 0;
        }
        #close {
            position: absolute;
            width: 18px;
            height: 18px;
            text-align: center;
            line-height: 18px;
            cursor: pointer;
            border: 1px solid #666;
        }
    </style>
</head>
<body>
    <div id="box">
        <img id="code" src="img/QQ.jpg" alt="" width="160px" height="170px">
        <span id="close">x</span>
    </div>
    <script>
        var newbox=document.getElementById('box');
        var newclose=document.getElementById('close');
        newclose.onclick=function(){
            newbox.style.display='none';
        }
    </script>
</body>
</html>